package com.lindroy.androidplayer.logic.network

import com.lindroy.androidplayer.logic.model.*
import retrofit2.Call
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

/**
 * @author Lin
 * @date 2021/4/6
 * @function 网络请求接口
 */
//region 首页模块
interface HomePageService {
    //轮播图
    @GET("banner/json")
    fun getBanner(): Call<HttpResult<List<BannerResp>>>

    //置顶文章
    @GET("article/top/json")
    fun getTopArticles(): Call<HttpResult<List<ArticleResp>>>

    //首页文章
    @GET("article/list/{page}/json")
    fun getArticles(@Path("page") page: Int): Call<HttpResult<ArticleListResp>>

}
//endregion 首页模块

//region 公众号模块
interface OfficialAccountService {
    //获取公众号列表
    @GET("wxarticle/chapters/json")
    fun getWXChapter(): Call<HttpResult<List<WXChapterResp>>>

    //获取某一公众号下的文章
    @GET("wxarticle/list/{id}/{page}/json")
    fun getWxArticle(@Path("id") id: Int, @Path("page") page: Int):
            Call<HttpResult<WXArticleListResp>>
}
//endregion 公众号模块

interface ProjectService {

    //获取所有的项目种类
    @GET("project/tree/json")
    fun getProjectTypes(): Call<HttpResult<List<ProjectTypesResp>>>
/*
    //获取某一项目类型下的项目
    @GET("project/list/{page}/json")
    fun getProjectList(
        @Path("page") page: Int,
        @Query("cid") cid: Int
    ): Call<HttpResult<ProjectResp>>*/
}

//region 登录登出模块
interface LoginService {

    @POST("user/login")
    fun login(
        @Query("username") userName: String,
        @Query("password") password: String
    ): Call<HttpResult<LoginResp>>
}
//endregion 登录登出模块

//region 注册模块
interface RegisterService {
    @POST("user/register")
    fun register(
        @Query("username") userName: String,
        @Query("password") password: String,
        @Query("repassword") repassword: String
    ): Call<HttpResult<LoginResp>>
}
//endregion 注册模块

